package com.econ.powercloud.ems.dal.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.econ.powercloud.ems.dal.entity.EmsUserOperateToken;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 用户操作密码信息配置表 Mapper 接口
 * </p>
 *
 * @author AutoGenerator
 * @since 2021-10-11
 */
public interface EmsUserOperateTokenMapper extends BaseMapper<EmsUserOperateToken> {
    /**
     * 通过用户名称获取用户操作配置信息
     * @param userId
     * @return
     */
    @Select("SELECT * FROM ems_user_operate_token WHERE user_operate_id = #{userId}")
    EmsUserOperateToken selectUserOperateByUserId(@Param("userId") String userId);


    /**
     * 通过用户名称更新最后校验时间
     * @param userId
     * @return
     */
    @Update("update ems_user_operate_token set last_login = NOW() where user_operate_id = #{userId}")
    void updateLastLoginByUserId(@Param("userId") String userId);

    /**
     * 通过用户名称更新密码
     * @param userId
     * @return
     */
    @Update("update ems_user_operate_token set operate_password = #{password},gmt_modify = NOW() where user_operate_id = #{userId}")
    void updatePassWordByUserId(@Param("password") String password,@Param("userId") String userId);
}
